<template>
	<view class="tripList">
		<view class="tabs-box">
			<view class="tabs flex-center">
				<view :class="{active:tabIndex == 0}" @click="changeTab(0)">我是乘客</view>
				<view :class="{active:tabIndex == 1}" @click="changeTab(1)">我是车主</view>
			</view>
		</view>
		<view class="list-box" v-if="tabIndex == 0">
			<block v-for="(item,index) in 10" :key="index">
				<view class="list" :class="index == 0 ? 'red' : 'green'">
					<view class="flex-between">
						<view class="h3">郑州市 —>周口市</view>
						<view class="status">
							<text v-if="index > 0">已完成</text>
							<text v-else>进行中</text>
						</view>
					</view>
					<view class="flex-between">
						<view>
							<view class="p">时间：2021-05-15 12:33</view>
							<view class="p">车主：
								<text>(行程结束，电话隐藏)</text>
							</view>
							<view class="p">人数：1人</view>
							<view class="p">上车点：万科广场</view>
						</view>
						<view>
							<!-- <navigator url="" class="btn flex-center">查看</navigator> -->
							<navigator url="" class="btn flex-center del" v-if="index > 0"  @click="del(index)">删除</navigator>
						</view>
					</view>
				</view>
			</block>
		</view>
		<view class="list-box" v-if="tabIndex == 1">
			<block v-for="(item,index) in 10" :key="index">
				<view class="list" :class="index == 0 ? 'red' : 'green'">
					<view class="flex-between">
						<view class="h3">郑州市 —>周口市</view>
						<view class="status">
							<text v-if="index > 0">已完成</text>
							<text v-else>进行中</text>
						</view>
					</view>
					<view class="flex-between">
						<view>
							<view class="p">时间：2021-05-15 12:33</view>
							<view class="p">订座/余座：
								<text>0人/3人</text>
							</view>
						</view>
						<view>
							<!-- <navigator url="" class="btn flex-center">查看</navigator> -->
							<view class="btn flex-center del" v-if="index > 0" @click="del(index)">删除</view>
						</view>
					</view>
				</view>
			</block>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				tabIndex:0,
			};
		},
		methods:{
			changeTab(i){
				this.tabIndex = i;
			},
			del(index){
				uni.showModal({
					content:'是否删除改行程？',
					confirmColor:'#4CD964',
					success:r=>{
						if(r.confirm){
							
						}
					}
				})
			}
		}
	}
</script>

<style lang="less">
	page{
		background: #f6f7f8;
	}
	.tripList{
		.tabs-box{
			height: 70rpx;
			width: 100vw;
			.tabs{
				width: 100vw;
				height: 70rpx;
				background: white;
				font-size: 30rpx;
				view{
					width: 40%;
					text-align: center;
					padding: 15rpx 0;
					border-bottom:4rpx solid #fff;
					color:#333;
					&.active{
						border-color: #4CD964;
						color:#4CD964;
						font-weight: bold;
					}
				}
			}
			
		}
		.list-box{
			margin-top: 30rpx;
			.list{
				background: white;
				padding: 20rpx 30rpx;
				margin-bottom: 30rpx;
				
				.h3{
					font-weight: bold;
					margin-bottom: 20rpx;
				}
				.status{
					font-size: 28rpx;
					
				}
				&.green{
					opacity: .7;
					.status{
						color: #4CD964;
					}
					
				}
				&.red{
					.status{
						color: red;
					}
					
				}
				.p{
					line-height: 1.5;
					font-size: 30rpx;
					width: 550rpx;
				}
				.btn{
					width: 100rpx;
					border:1px solid #000;
					height: 50rpx;
					font-size: 30rpx;
					color:#000;
					&.del{
						background: #aaa;
						color:#fff;
						border-color:#aaa;
						margin-top: 30rpx;
					}
				}
			}
		}
	}
</style>
